\(\int \cot ^5(e+f x) (a+b \sec ^2(e+f x))^2 \, dx\) [329]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 23, antiderivative size = 51 \[ \int \cot ^5(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=\frac {a (a+b) \csc ^2(e+f x)}{f}-\frac {(a+b)^2 \csc ^4(e+f x)}{4 f}+\frac {a^2 \log (\sin (e+f x))}{f} \]

[Out]

a*(a+b)*csc(f*x+e)^2/f-1/4*(a+b)^2*csc(f*x+e)^4/f+a^2*ln(sin(f*x+e))/f

Rubi [A] (verified)

Time = 0.11 (sec) , antiderivative size = 51, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.130, Rules used = {4223, 455, 45} \[ \int \cot ^5(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=\frac {a^2 \log (\sin (e+f x))}{f}-\frac {(a+b)^2 \csc ^4(e+f x)}{4 f}+\frac {a (a+b) \csc ^2(e+f x)}{f} \]

[In]

Int[Cot[e + f*x]^5*(a + b*Sec[e + f*x]^2)^2,x]

[Out]

(a*(a + b)*Csc[e + f*x]^2)/f - ((a + b)^2*Csc[e + f*x]^4)/(4*f) + (a^2*Log[Sin[e + f*x]])/f

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 455

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] && NeQ[b*c - a*d, 0] && EqQ[m
- n + 1, 0]

Rule 4223

Int[((a_) + (b_.)*sec[(e_.) + (f_.)*(x_)]^(n_))^(p_.)*tan[(e_.) + (f_.)*(x_)]^(m_.), x_Symbol] :> Module[{ff =
 FreeFactors[Cos[e + f*x], x]}, Dist[-(f*ff^(m + n*p - 1))^(-1), Subst[Int[(1 - ff^2*x^2)^((m - 1)/2)*((b + a*
(ff*x)^n)^p/x^(m + n*p)), x], x, Cos[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, n}, x] && IntegerQ[(m - 1)/2] &&
IntegerQ[n] && IntegerQ[p]

Rubi steps \begin{align*} \text {integral}& = -\frac {\text {Subst}\left (\int \frac {x \left (b+a x^2\right )^2}{\left (1-x^2\right )^3} \, dx,x,\cos (e+f x)\right )}{f} \\ & = -\frac {\text {Subst}\left (\int \frac {(b+a x)^2}{(1-x)^3} \, dx,x,\cos ^2(e+f x)\right )}{2 f} \\ & = -\frac {\text {Subst}\left (\int \left (-\frac {(a+b)^2}{(-1+x)^3}-\frac {2 a (a+b)}{(-1+x)^2}-\frac {a^2}{-1+x}\right ) \, dx,x,\cos ^2(e+f x)\right )}{2 f} \\ & = \frac {a (a+b) \csc ^2(e+f x)}{f}-\frac {(a+b)^2 \csc ^4(e+f x)}{4 f}+\frac {a^2 \log (\sin (e+f x))}{f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.30 (sec) , antiderivative size = 77, normalized size of antiderivative = 1.51 \[ \int \cot ^5(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=-\frac {\left (b+a \cos ^2(e+f x)\right )^2 \left (-4 a (a+b) \csc ^2(e+f x)+(a+b)^2 \csc ^4(e+f x)-4 a^2 \log (\sin (e+f x))\right )}{f (a+2 b+a \cos (2 (e+f x)))^2} \]

[In]

Integrate[Cot[e + f*x]^5*(a + b*Sec[e + f*x]^2)^2,x]

[Out]

-(((b + a*Cos[e + f*x]^2)^2*(-4*a*(a + b)*Csc[e + f*x]^2 + (a + b)^2*Csc[e + f*x]^4 - 4*a^2*Log[Sin[e + f*x]])
)/(f*(a + 2*b + a*Cos[2*(e + f*x)])^2))

Maple [A] (verified)

Time = 5.40 (sec) , antiderivative size = 71, normalized size of antiderivative = 1.39

method result size
derivativedivides \(\frac {a^{2} \left (-\frac {\cot \left (f x +e \right )^{4}}{4}+\frac {\cot \left (f x +e \right )^{2}}{2}+\ln \left (\sin \left (f x +e \right )\right )\right )-\frac {a b \cos \left (f x +e \right )^{4}}{2 \sin \left (f x +e \right )^{4}}-\frac {b^{2}}{4 \sin \left (f x +e \right )^{4}}}{f}\) \(71\)
default \(\frac {a^{2} \left (-\frac {\cot \left (f x +e \right )^{4}}{4}+\frac {\cot \left (f x +e \right )^{2}}{2}+\ln \left (\sin \left (f x +e \right )\right )\right )-\frac {a b \cos \left (f x +e \right )^{4}}{2 \sin \left (f x +e \right )^{4}}-\frac {b^{2}}{4 \sin \left (f x +e \right )^{4}}}{f}\) \(71\)
risch \(-i a^{2} x -\frac {2 i a^{2} e}{f}-\frac {4 \left (a^{2} {\mathrm e}^{6 i \left (f x +e \right )}+a b \,{\mathrm e}^{6 i \left (f x +e \right )}-a^{2} {\mathrm e}^{4 i \left (f x +e \right )}+b^{2} {\mathrm e}^{4 i \left (f x +e \right )}+a^{2} {\mathrm e}^{2 i \left (f x +e \right )}+a b \,{\mathrm e}^{2 i \left (f x +e \right )}\right )}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right )^{4}}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right ) a^{2}}{f}\) \(134\)

[In]

int(cot(f*x+e)^5*(a+b*sec(f*x+e)^2)^2,x,method=_RETURNVERBOSE)

[Out]

1/f*(a^2*(-1/4*cot(f*x+e)^4+1/2*cot(f*x+e)^2+ln(sin(f*x+e)))-1/2*a*b/sin(f*x+e)^4*cos(f*x+e)^4-1/4*b^2/sin(f*x
+e)^4)

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 97, normalized size of antiderivative = 1.90 \[ \int \cot ^5(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=-\frac {4 \, {\left (a^{2} + a b\right )} \cos \left (f x + e\right )^{2} - 3 \, a^{2} - 2 \, a b + b^{2} - 4 \, {\left (a^{2} \cos \left (f x + e\right )^{4} - 2 \, a^{2} \cos \left (f x + e\right )^{2} + a^{2}\right )} \log \left (\frac {1}{2} \, \sin \left (f x + e\right )\right )}{4 \, {\left (f \cos \left (f x + e\right )^{4} - 2 \, f \cos \left (f x + e\right )^{2} + f\right )}} \]

[In]

integrate(cot(f*x+e)^5*(a+b*sec(f*x+e)^2)^2,x, algorithm="fricas")

[Out]

-1/4*(4*(a^2 + a*b)*cos(f*x + e)^2 - 3*a^2 - 2*a*b + b^2 - 4*(a^2*cos(f*x + e)^4 - 2*a^2*cos(f*x + e)^2 + a^2)
*log(1/2*sin(f*x + e)))/(f*cos(f*x + e)^4 - 2*f*cos(f*x + e)^2 + f)

Sympy [F]

\[ \int \cot ^5(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=\int \left (a + b \sec ^{2}{\left (e + f x \right )}\right )^{2} \cot ^{5}{\left (e + f x \right )}\, dx \]

[In]

integrate(cot(f*x+e)**5*(a+b*sec(f*x+e)**2)**2,x)

[Out]

Integral((a + b*sec(e + f*x)**2)**2*cot(e + f*x)**5, x)

Maxima [A] (verification not implemented)

none

Time = 0.18 (sec) , antiderivative size = 61, normalized size of antiderivative = 1.20 \[ \int \cot ^5(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=\frac {2 \, a^{2} \log \left (\sin \left (f x + e\right )^{2}\right ) + \frac {4 \, {\left (a^{2} + a b\right )} \sin \left (f x + e\right )^{2} - a^{2} - 2 \, a b - b^{2}}{\sin \left (f x + e\right )^{4}}}{4 \, f} \]

[In]

integrate(cot(f*x+e)^5*(a+b*sec(f*x+e)^2)^2,x, algorithm="maxima")

[Out]

1/4*(2*a^2*log(sin(f*x + e)^2) + (4*(a^2 + a*b)*sin(f*x + e)^2 - a^2 - 2*a*b - b^2)/sin(f*x + e)^4)/f

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 332 vs. \(2 (49) = 98\).

Time = 0.36 (sec) , antiderivative size = 332, normalized size of antiderivative = 6.51 \[ \int \cot ^5(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=\frac {32 \, a^{2} \log \left (\frac {{\left | -\cos \left (f x + e\right ) + 1 \right |}}{{\left | \cos \left (f x + e\right ) + 1 \right |}}\right ) - 64 \, a^{2} \log \left ({\left | -\frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1} + 1 \right |}\right ) - \frac {12 \, a^{2} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac {8 \, a b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {4 \, b^{2} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac {a^{2} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} - \frac {2 \, a b {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} - \frac {b^{2} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} - \frac {{\left (a^{2} + 2 \, a b + b^{2} + \frac {12 \, a^{2} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {8 \, a b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac {4 \, b^{2} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {48 \, a^{2} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}}\right )} {\left (\cos \left (f x + e\right ) + 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) - 1\right )}^{2}}}{64 \, f} \]

[In]

integrate(cot(f*x+e)^5*(a+b*sec(f*x+e)^2)^2,x, algorithm="giac")

[Out]

1/64*(32*a^2*log(abs(-cos(f*x + e) + 1)/abs(cos(f*x + e) + 1)) - 64*a^2*log(abs(-(cos(f*x + e) - 1)/(cos(f*x +
 e) + 1) + 1)) - 12*a^2*(cos(f*x + e) - 1)/(cos(f*x + e) + 1) - 8*a*b*(cos(f*x + e) - 1)/(cos(f*x + e) + 1) +
4*b^2*(cos(f*x + e) - 1)/(cos(f*x + e) + 1) - a^2*(cos(f*x + e) - 1)^2/(cos(f*x + e) + 1)^2 - 2*a*b*(cos(f*x +
 e) - 1)^2/(cos(f*x + e) + 1)^2 - b^2*(cos(f*x + e) - 1)^2/(cos(f*x + e) + 1)^2 - (a^2 + 2*a*b + b^2 + 12*a^2*
(cos(f*x + e) - 1)/(cos(f*x + e) + 1) + 8*a*b*(cos(f*x + e) - 1)/(cos(f*x + e) + 1) - 4*b^2*(cos(f*x + e) - 1)
/(cos(f*x + e) + 1) + 48*a^2*(cos(f*x + e) - 1)^2/(cos(f*x + e) + 1)^2)*(cos(f*x + e) + 1)^2/(cos(f*x + e) - 1
)^2)/f

Mupad [B] (verification not implemented)

Time = 20.71 (sec) , antiderivative size = 83, normalized size of antiderivative = 1.63 \[ \int \cot ^5(e+f x) \left (a+b \sec ^2(e+f x)\right )^2 \, dx=\frac {a^2\,\ln \left (\mathrm {tan}\left (e+f\,x\right )\right )}{f}-\frac {\frac {a\,b}{2}+\frac {a^2}{4}+\frac {b^2}{4}-{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (\frac {a^2}{2}-\frac {b^2}{2}\right )}{f\,{\mathrm {tan}\left (e+f\,x\right )}^4}-\frac {a^2\,\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )}{2\,f} \]

[In]

int(cot(e + f*x)^5*(a + b/cos(e + f*x)^2)^2,x)

[Out]

(a^2*log(tan(e + f*x)))/f - ((a*b)/2 + a^2/4 + b^2/4 - tan(e + f*x)^2*(a^2/2 - b^2/2))/(f*tan(e + f*x)^4) - (a
^2*log(tan(e + f*x)^2 + 1))/(2*f)